<template>
  <div class="subjectName">
    <div class="title">
      <span class="title-name">项目名称：</span>
      <span class="title-content">{{ message.subjectName }}</span>
    </div>
    <div class="progress">
      <div class="img1">
        <img src="../assets/images/user-one.png" alt="" />
        <div class="txt">挑选项目</div>
      </div>
      <div class="line">
        <img src="../assets/images/user-row.png" alt="" />
      </div>
      <div class="img1">
        <img src="../assets/images/user-two.png" alt="" />
        <div class="txt">提交项目申请</div>
      </div>
      <div class="line">
        <img src="../assets/images/user-row.png" alt="" />
      </div>
      <div class="img1">
        <img src="../assets/images/user-three.png" alt="" />
        <div class="txt">提交任务申领书</div>
      </div>
      <div class="line">
        <img src="../assets/images/user-row.png" alt="" />
      </div>
      <div class="img1">
        <img src="../assets/images/user-four.png" alt="" />
        <div class="txt">提交结项报告</div>
      </div>
    </div>
    <div class="content">
      <!-- <div class="left">
        <img src="../assets/images/user-word.png" alt="" /><a
          :href="downloadUrl"
          >点击下载任务申领书模板</a
        >
      </div> -->
      <div class="midd">
        <img src="../assets/images/user-excel.png" alt="" />
      </div>
      <div class="right">
        <div class="uploadPic">
          <el-form :model="query" ref="ruleForm">
            <el-form-item label="" prop="knotImage">
              <cardFile
                :url="uploadUrl"
                :showIcon="false"
                :acceptType="acceptT"
                :fileL="fileList"
                @removeFlie="removeF"
                @afterUploaded="afterUploaded"
                :UpType="'word'"
              ></cardFile>
              <div class="tips" v-show="isShowImage">
                必须上传一个.doc/.docx/zip/rar格式的文件
              </div>
            </el-form-item>
          </el-form>
        </div>
      </div>
    </div>
    <div class="remark">
      <span
        >备注：报名成功，题目已被锁定。请在7日内提交《项目申请书》，包含但不限于以下信息：</span
      >
      <span
        >设计图，方案描述，验证方法，关键技术，软硬件工具，等待导师确认。</span
      >
    </div>
    <div class="sub">
      <el-button type="primary" @click="submit">提 交</el-button>
    </div>
  </div>
</template>
<script>
import cardFile from "./commonComponent/uploadfile.vue";
export default {
  components: {
    cardFile,
  },
  data() {
    return {
      downloadUrl:
        "http://139.159.252.23:9089/template (6)_2021_10_19_1146503465.xlsx",
      message: {
        id: "",
        count: "",
        subjectName: "",
        mentorContact: "", //联系方式
        facultyProfile: "", //导师简介
      }, //课题信息
      uploadUrl: "/signUp/uoload",
      acceptT: ".doc, .docx, .zip, .rar",
      isShowImage: false,
      fileList: [],
      query: {
        userId: "",
        knotImage: "",
      },
    };
  },
  created() {
    this.getMessage();
  },
  methods: {
    async getMessage() {
      let usermessage = JSON.parse(sessionStorage.getItem("userContent"));
      this.message = Object.assign({}, usermessage);
    },
    removeF() {
      this.fileList = [];
      this.query.knotImage = "";
      this.isShowImage = false;
    },
    afterUploaded(url) {
      this.query.knotImage = url;
      this.isShowImage = false;
    },
    submit() {
      this.$refs["ruleForm"].validate(async (valid) => {
        this.isShowImage = !this.query.knotImage;
        if (valid && !this.isShowImage) {
          let userId = this.message.id;
          let obj = Object.assign({}, this.query, { userId });
          let res = await this.$axios.post("/signUp/saveKnotImage", obj);
          if (res.data.code == 0) {
            this.isShowImage = false;
            this.$message.success(res.data.msg);
            this.$router.push("/userloading");
          }
        }
      });
    },
  },
};
</script>
<style lang="less" scoped>
.subjectName {
  height: 100%;
  width: 50%;
  transform: translate(50%);
  text-align: center;
  .title {
    margin-top: 40px;
    .title-name {
      height: 48px;
      font-size: 36px;
      font-weight: 500;
      line-height: 48px;
      color: #000000;
      opacity: 0.9;
    }
    .title-content {
      height: 48px;
      font-size: 36px;
      font-weight: 500;
      line-height: 48px;
      color: #1169ff;
      border-bottom: 1px solid #1169ff;
    }
  }
  .progress {
    display: flex;
    justify-content: space-between;
    margin-top: 40px;
    .img1 {
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      img {
        width: 64px;
        height: 64px;
        margin-bottom: 4px;
      }
      .txt {
        font-size: 14px;
        font-weight: 400;
        line-height: 18px;
        color: #000000;
        opacity: 0.8;
      }
    }
    .line {
      height: 64px;
      display: flex;
      align-items: center;
      img {
        width: 50%;
        transform: translate(50%);
      }
    }
  }
  .content {
    margin-top: 80px;
    display: flex;
    justify-content: center;
    .left {
      margin-right: 24px;
      img {
        width: 48px;
      }
    }
    .midd {
      img {
        width: 48px;
      }
    }
    .right {
      display: flex;
      .uploadPic {
        text-align: left;
        padding-top: 5px;
        ::v-deep .tips {
          color: #f56c6c;
          margin-bottom: -20px;
          font-size: 12px;
        }
      }
    }
  }
  .remark {
    font-size: 12px;
    font-weight: 400;
    line-height: 16px;
    color: #ff792c;
    margin-top: 20px;
  }
  .sub {
    margin-top: 70px;
  }
  ::v-deep .el-button--primary {
    width: 168px;
    height: 40px;
    background: #0a59f7;
    border-radius: 2px;
  }
}
@media screen and (max-width: 500px) {
  .subjectName {
    width: 100%;
    transform: translateX(0);
    .title {
      margin-top: 20px;
      .title-name {
        font-size: 24px;
      }
      .title-content {
        font-size: 24px;
      }
    }
    .progress {
      .img1 {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: start;
        img {
          width: 36px;
          height: 36px;
        }
        .txt {
          font-size: 12px;
          width: 66px;
        }
      }
      .line {
        height: 36px;
      }
    }
    .content {
      margin-top: 40px;
      display: flex;
      justify-content: center;
    }
    .remark {
      margin-top: 10px;
      padding: 0 20px;
    }
    .sub {
      margin-top: 30px;
    }
  }
}
</style>
